package com.bw.spark02.rdd.action

import org.apache.spark.{SparkConf, SparkContext}


object RDD_13_fold {
    
    def main(args: Array[String]): Unit = {
    
        // 初始化编程入口
        val sparkConf = new SparkConf()
        sparkConf.setMaster("local")
        sparkConf.setAppName("RDD_Test")
        val sc = new SparkContext(sparkConf)
    
        val rdd = sc.parallelize(List(1,2,3), 3)
        val result: Int = rdd.fold(0)(_ + _)
        
        println(result)
    }
}
